#ifndef _PTHREADPOOL_H_
#define _PTHREADPOOL_H_

#include <pthread.h>
//#include "filedispat.h"

#define THREADPOOL_ON 	1
#define THREADPOOL_OFF	0

typedef struct Conndata{
	int event_fd;
	int efd_size;
	struct threadpool *pool;
}Conndata;

typedef struct Task{
	void (*func)(void *);
	void *arg;
}Task;

typedef struct threadpool{
	int Frount;						
	int Rear;						
	int queue_size;					
	
	pthread_mutex_t mutex;
	pthread_mutex_t link_lock;
	pthread_cond_t cond;
	pthread_cond_t Task_add_cond;
	pthread_t admin_threadID;
	pthread_t *pidID;

	Task *Task_queue;				
	
	int pthread_max;
	int queue_max;

	int shutdown;
}threadpool;

threadpool *threadpool_create(int pthread_max,int queue_max);
void *start_routine(void *arg);
void Connect_procfunc(void *arg);
void Message_procfunc(void *arg);
void File_Message_procfunc(void *arg);
void Epoll_Detection_profunc(void *arg);

void pthreadpool_Taks_add(threadpool *pool,void (*task_func)(void *),void *arg);
void pthreadpool_destroy(threadpool *pool);



#endif 
